package org.csmzxy.class2334;

class User {
    private String name;
    private int age;

    public void setName(String name) {
        if (name != null &&!name.isEmpty()) {
            this.name = name;
        } else {
            System.err.println("姓名不能为空");
        }
    }

    public void setAge(int age) {
        if (age > 0) {
            this.age = age;
        } else {
            System.err.println("年龄必须大于0");
        }
    }

    public void print() {
        String name = "李四";
        int age = 20;
        System.out.println(" 姓名 = " + this.name + ", 年纪 = " + this.age);
        System.out.println(" 姓名 = " + name + ", 年纪 = " + age);
    }
}

